package org.origin.centre.model.base;

import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;

/**
 * 分页查询对象-实体类
 *
 * @author ferret
 * @version 2024-05-08
 */
@Schema(description = "分页查询对象-实体类")
public class XPage<T> {
    @Schema(description = "当前页，默认 1", example = "1")
    private Integer pageNum;
    @Schema(description = "每页显示条数，默认 10", example = "10")
    private Integer pageSize;
    @Schema(description = "排序参数")
    private List<String> orders;
    @Schema(description = "过滤参数")
    private T params;

    public Integer getPageNum() {
        return this.pageNum != null && this.pageNum > 0 ? this.pageNum : 1;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return this.pageSize != null && this.pageSize > 0 ? this.pageSize : 10;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public T getParams() {
        return params;
    }

    public void setParams(T params) {
        this.params = params;
    }

    public List<String> getOrders() {
        return orders;
    }

    public void setOrders(List<String> orders) {
        this.orders = orders;
    }
}
